Jx().package("s.ui.controls", function(t) {
    "use strict";
    var i = 0;
    this.mLineChart = new t.Class({
        extend: s.ui.BaseControl
    },{
        defaults: {
            color: {
                lineColor: "#e1e1e1",
                closeLineColor: "#a0a0a0",
                fontColor: "#7f7f7f",
                pointerColor: "#db3338",
                toolBgColor: "#fff",
                volUpColor: "#db3338",
                volDownColr: "#319e26",
                newestColor: "#569afe",
                averageColor: "#afd665",
                iopvColor: "#F230E4"
            },
            codeReg: /^399?/,
            grid: {
                index: [["4%", 20, "10%", 75], ["100%", "100%", 0, 0]],
                sec: [["4%", 85, "48%", 60], ["65%", 85, "7%", 60]]
            },
            failGrid: {
                index: [["4%", 20, "10%", 40], ["100%", "100%", 0, 0]],
                sec: [["4%", 60, "48%", 60], ["65%", 60, "7%", 60]]
            }
        },
        attributeMap: {},
        init: function(t, a) {
            this.element = $(t),
            this.element.data("initialized") || (this.element.data("initialized", !0),
            i += 1,
            this.element.data("plugin-id", i),
            this.initSettings(a),
            this.settings.isEn = window.util.isEnglish(),
            this.parseData(this.settings.data),
            this.calcuBaseline(),
            this.render(this.chartData))
        },
        parseData: function(t) {
            if ($.isEmptyObject(t))
                console.warn("mLineChart控件未获取到数据!");
            else {
                var a = t.type
                  , i = t.datetime && t.datetime.split(" ")[0] || "";
                t.data.groupId;
                t = t.data;
                var s = this.calcuDecimal(t.picupdata, !1) || t.close && t.close.split(".")[1].length || 2;
                this.chartData = {
                    isSec: !this.settings.codeReg.test(t.code),
                    isInit: !1,
                    isBond: a && "bond" === a,
                    groupId: +t.groupId,
                    isPledgeStyleBond: 6 == +t.groupId,
                    isChinext: 17 == +t.groupId,
                    isOption: a && "option" === a,
                    code: t.code,
                    time: i,
                    close: +t.close,
                    open: +t.open,
                    decimal: s,
                    newest: t.picupdata,
                    average: t.picavgprice,
                    volumes: t.picdowndata,
                    iopv: t.piciopv,
                    isDelisting: !0 === t.isDelisting,
                    categoryData: ["09:30", "09:31", "09:32", "09:33", "09:34", "09:35", "09:36", "09:37", "09:38", "09:39", "09:40", "09:41", "09:42", "09:43", "09:44", "09:45", "09:46", "09:47", "09:48", "09:49", "09:50", "09:51", "09:52", "09:53", "09:54", "09:55", "09:56", "09:57", "09:58", "09:59", "10:00", "10:01", "10:02", "10:03", "10:04", "10:05", "10:06", "10:07", "10:08", "10:09", "10:10", "10:11", "10:12", "10:13", "10:14", "10:15", "10:16", "10:17", "10:18", "10:19", "10:20", "10:21", "10:22", "10:23", "10:24", "10:25", "10:26", "10:27", "10:28", "10:29", "10:30", "10:31", "10:32", "10:33", "10:34", "10:35", "10:36", "10:37", "10:38", "10:39", "10:40", "10:41", "10:42", "10:43", "10:44", "10:45", "10:46", "10:47", "10:48", "10:49", "10:50", "10:51", "10:52", "10:53", "10:54", "10:55", "10:56", "10:57", "10:58", "10:59", "11:00", "11:01", "11:02", "11:03", "11:04", "11:05", "11:06", "11:07", "11:08", "11:09", "11:10", "11:11", "11:12", "11:13", "11:14", "11:15", "11:16", "11:17", "11:18", "11:19", "11:20", "11:21", "11:22", "11:23", "11:24", "11:25", "11:26", "11:27", "11:28", "11:29", "11:30", "13:01", "13:02", "13:03", "13:04", "13:05", "13:06", "13:07", "13:08", "13:09", "13:10", "13:11", "13:12", "13:13", "13:14", "13:15", "13:16", "13:17", "13:18", "13:19", "13:20", "13:21", "13:22", "13:23", "13:24", "13:25", "13:26", "13:27", "13:28", "13:29", "13:30", "13:31", "13:32", "13:33", "13:34", "13:35", "13:36", "13:37", "13:38", "13:39", "13:40", "13:41", "13:42", "13:43", "13:44", "13:45", "13:46", "13:47", "13:48", "13:49", "13:50", "13:51", "13:52", "13:53", "13:54", "13:55", "13:56", "13:57", "13:58", "13:59", "14:00", "14:01", "14:02", "14:03", "14:04", "14:05", "14:06", "14:07", "14:08", "14:09", "14:10", "14:11", "14:12", "14:13", "14:14", "14:15", "14:16", "14:17", "14:18", "14:19", "14:20", "14:21", "14:22", "14:23", "14:24", "14:25", "14:26", "14:27", "14:28", "14:29", "14:30", "14:31", "14:32", "14:33", "14:34", "14:35", "14:36", "14:37", "14:38", "14:39", "14:40", "14:41", "14:42", "14:43", "14:44", "14:45", "14:46", "14:47", "14:48", "14:49", "14:50", "14:51", "14:52", "14:53", "14:54", "14:55", "14:56", "14:57", "14:58", "14:59", "15:00"],
                    extCategoryData: ["15:06", "15:07", "15:08", "15:09", "15:10", "15:11", "15:12", "15:13", "15:14", "15:15", "15:16", "15:17", "15:18", "15:19", "15:20", "15:21", "15:22", "15:23", "15:24", "15:25", "15:26", "15:27", "15:28", "15:29", "15:30"]
                },
                function() {
                    this.unitIsZhang = this.isBond || this.isOption
                }
                .call(this.chartData),
                null === t.picupdata ? (t.close = "0.02",
                this.chartData.close = +t.close,
                this.chartData.isFail = !0,
                this.chartData.isInit = !0,
                this.initTrend(t)) : 0 === t.picupdata.length && (this.chartData.isInit = !0,
                this.initTrend(t)),
                this.element.width() < 295 && (this.w295 = !0),
                this.element.width() < 365 && (this.w365 = !0)
            }
        },
        initFailTrend: function(t) {},
        initTrend: function(t, a) {
            for (var i, s, e, n, o = t.close.split(".")[1].length - 1, r = "0.", l = 0; l < o; l++)
                r += "0";
            r += "1",
            e = window.util.fSubtract(t.close, r),
            s = window.util.fSubtract(e, r),
            n = window.util.fAdd(t.close, r),
            i = window.util.fAdd(n, r),
            this.chartData.initY1Data = [s, e, t.close, n, i],
            a || (this.chartData.initY2Data = ["0", "5", "10"]),
            this.chartData.yData = {
                min: s,
                max: i,
                interval: +r,
                threeQuarter: n,
                quarter: e
            }
        },
        calcuDecimal: function(t, a) {
            var i = t && t.length
              , s = "";
            if (!a && i)
                return t.every(function(t) {
                    var a = t[1];
                    return !/\./g.test(a) || (s = a.split(".")[1].length,
                    !1)
                }),
                s
        },
        calcuBaseline: function() {
            if (!this.chartData.isInit) {
                var t, a, i, s, e, n, o, r, l, h, c, d = this.chartData.newest.length, u = [], p = !1;
                if (1 === d)
                    if (p = !0,
                    this.chartData.isOneData = p,
                    this.chartData.open > this.chartData.close)
                        t = this.chartData.open,
                        o = Math.abs(window.util.fSubtract(t, this.chartData.close));
                    else {
                        if (!(this.chartData.open < this.chartData.close))
                            return void this.initTrend({
                                close: this.chartData.close.toFixed(this.chartData.decimal)
                            }, p);
                        a = this.chartData.open,
                        o = Math.abs(window.util.fSubtract(a, this.chartData.close))
                    }
                else if (this.chartData.newest.map(function(t) {
                    u.push(+t[1].replace(/\./g, "")),
                    t[7] && u.push(+t[7].replace(/\./g, ""))
                }),
                a = this.reDeci(Math.min.apply(null, u), this.chartData.decimal),
                t = this.reDeci(Math.max.apply(null, u), this.chartData.decimal),
                i = window.util.fSubtract(t, this.chartData.close),
                s = window.util.fSubtract(this.chartData.close, a),
                e = Math.abs(i),
                0 == +(o = (n = Math.abs(s)) <= e ? e + "" : n + ""))
                    return void this.initTrend({
                        close: this.chartData.close.toFixed(this.chartData.decimal)
                    });
                o = 0 == (r = +window.util.fRemainder(o, 2)) ? o : window.util.fAdd(o, r),
                t = window.util.fAdd(this.chartData.close, o),
                a = window.util.fSubtract(this.chartData.close, o),
                l = +o / 2,
                h = window.util.fAdd(a, l),
                c = window.util.fSubtract(t, l),
                this.chartData.yData = {
                    min: a,
                    max: t,
                    interval: l,
                    threeQuarter: c,
                    quarter: h
                },
                p && (this.chartData.initY1Data = [a, h, this.chartData.close, c, t])
            }
        },
        reDeci: function(t, a) {
            for (var i = (t += "").length - a, s = "", e = i; e < 0; e++)
                s += "0";
            return i <= 0 ? "0." + s + t : t.slice(0, i) + "." + t.slice(-a)
        },
        render: function(t) {
            this.secLine(t)
        },
        bindEvents: function() {},
        buildTooltip: function(t) {
            return this.settings.isEn ? this.tooltipEn(t) : this.tooltip(t)
        },
        tooltip: function(t) {
            var a = +t.axisValue.replace(":", "")
              , i = this.chartData.isChinext && 1505 <= a
              , s = $("<div>")
              , e = 0
              , n = '<div class="sectooltip-container' + (i ? " after-hour" : "") + '">';
            return n += '<span class="time">' + this.chartData.time + "&nbsp;&nbsp;" + t.data[0] + "</span><br/>",
            this.chartData.isSec ? (i || (n += '<span class="name newest ' + (!0 === t.newIsDown ? "new-down" : "new-up") + '"><i>：</i>最新</span><span class="value newest ' + (!0 === t.newIsDown ? "new-down" : "new-up") + '">' + this.formatToolTipsData(t.data[1]) + '</span><br/><span class="name"><i>：</i>均价</span><span class="value ' + (!0 === t.averageIsDown ? "average-down" : "average-up") + '">' + this.formatToolTipsData(t.data[2]) + "</span><br/>"),
            e = 1) : n += '<span class="name newest ' + (!0 === t.newIsDown ? "new-down" : "new-up") + '"><i>：</i>指数</span><span class="value newest ' + (!0 === t.newIsDown ? "new-down" : "new-up") + '">' + this.formatToolTipsData(t.data[1]) + "</span><br/>",
            i || (n += '<span class="name"><i>：</i>涨跌</span><span class="value ' + (!0 === t.deltaIsDown ? "delta-down" : "delta-up") + '">' + this.formatToolTipsData(t.data[e + 2]) + '</span><br/><span class="name"><i>：</i>涨' + (this.chartData.isChinext || 1 == this.chartData.groupId || 2 == this.chartData.groupId || 10 == this.chartData.groupId ? "跌" : "") + '幅</span><span class="value ' + (!0 === t.deltaIsDown ? "delta-down" : "delta-up") + '">' + this.formatToolTipsData(t.data[e + 3]) + "%</span><br/>"),
            n += '<span class="name"><i>：</i>' + (i ? "盘后" : "") + '成交量</span><span class="value">' + this.calcuUnit(t.data[e + 4], 2) + (this.chartData.unitIsZhang ? "张" : "手") + '</span><br/><span class="name"><i>：</i>' + (i ? "盘后" : "") + '成交额</span><span class="value">' + this.calcuUnit(t.data[e + 5], 2) + "元</span><br/>" + (t.data[e + 6] ? '<span class="name"><i>：</i>IOPV</span><span class="value">' + this.formatToolTipsData(t.data[e + 6]) + "元</span><br/>" : "") + "</div>",
            s.html(n)
        },
        tooltipEn: function(t) {
            var a = +t.axisValue.replace(":", "")
              , i = this.chartData.isChinext && 1505 <= a
              , s = $("<div>")
              , e = 0
              , n = '<div class="sectooltip-container english' + (i ? " after-hour" : "") + ("10,000" !== this.calcuUnitEn(t.data[e + 4], 2, !0).unit ? " w165" : "") + ("100Mil." !== this.calcuUnitEn(t.data[e + 4], 2, !0).uni ? " w170" : "") + '">';
            return n += '<span class="time">' + this.chartData.time + "&nbsp;&nbsp;" + t.data[0] + "</span><br/>",
            this.chartData.isSec ? (i || (n += '<span class="name newest ' + (!0 === t.newIsDown ? "new-down" : "new-up") + '"><i>：</i>Last</span><span class="value newest ' + (!0 === t.newIsDown ? "new-down" : "new-up") + '">' + this.formatToolTipsData(t.data[1]) + '</span><br/><span class="name"><i>：</i>Average</span><span class="value ' + (!0 === t.averageIsDown ? "average-down" : "average-up") + '">' + this.formatToolTipsData(t.data[2]) + "</span><br/>"),
            e = 1) : n += '<span class="name newest ' + (!0 === t.newIsDown ? "new-down" : "new-up") + '"><i>：</i>Index</span><span class="value newest ' + (!0 === t.newIsDown ? "new-down" : "new-up") + '">' + this.formatToolTipsData(t.data[1]) + "</span><br/>",
            i || (n += '<span class="name"><i>：</i>Change</span><span class="value ' + (!0 === t.deltaIsDown ? "delta-down" : "delta-up") + '">' + this.formatToolTipsData(t.data[e + 2]) + '</span><br/><span class="name"><i>：</i>Change(%)</span><span class="value ' + (!0 === t.deltaIsDown ? "delta-down" : "delta-up") + '">' + this.formatToolTipsData(t.data[e + 3]) + "</span><br/>"),
            n += '<span class="name"><i>：</i>' + (i ? "After-hour " : "") + "Volume(" + this.calcuUnitEn(t.data[e + 4], 2, !0).unit + ')</span><span class="value">' + this.calcuUnitEn(t.data[e + 4], 2, !0).value + '</span><br/><span class="name"><i>：</i>' + (i ? "After-hour " : "") + "Amount(" + this.calcuUnitEn(t.data[e + 5], 2).unit + ')</span><span class="value">' + this.calcuUnitEn(t.data[e + 5], 2).value + "</span><br/>" + (t.data[e + 6] ? '<span class="name"><i>：</i>IOPV</span><span class="value">' + this.formatToolTipsData(t.data[e + 6]) + "元</span><br/>" : "") + "</div>",
            s.html(n)
        },
        formatToolTipsData: function(t) {
            return null == t ? "--" : t
        },
        parseTooltipsData: function(t) {
            var a = this.chartData.close
              , i = /^\-/;
            this.chartData.isSec ? (t.newIsDown = +t.data[1] < a,
            t.averageIsDown = +t.data[2] < a,
            t.deltaIsDown = i.test(t.data[3])) : (t.newIsDown = +t.data[1] < a,
            t.deltaIsDown = i.test(t.data[2]))
        },
        calcuUnit: function(t, a) {
            var i = "";
            return null == t ? "--" : 1 <= t / 1e8 ? (i = t / 1e8).toString().length < 4 ? i + "亿" : i.toFixed(a) + "亿" : 1 <= t / 1e4 ? (i = t / 1e4).toString().length < 4 ? i + "万" : i.toFixed(a) + "万" : t
        },
        calcuUnitEn: function(t, a, i) {
            var s = ""
              , e = ""
              , n = "";
            return this.settings.unitCache && this.settings.unitCache.num === t && this.settings.unitCache.unitIsZhang === this.chartData.unitIsZhang ? this.settings.unitCache.result : (e = null == t ? (s = i ? this.chartData.unitIsZhang ? "10" : "100" : "Yuan",
            "--") : 1 <= t / 1e8 ? (n = t / 1e8,
            s = i ? this.chartData.unitIsZhang ? "Bil." : "10Bil." : "100Mil.",
            n.toString().length < 4 ? n : n.toFixed(a)) : 1 <= t / 1e4 ? (n = t / 1e4,
            s = i ? this.chartData.unitIsZhang ? "10,000" : "Mil." : "10,000",
            n.toString().length < 4 ? n : n.toFixed(a)) : (s = i ? "100" : "Yuan",
            t),
            this.settings.unitCache = {
                num: t,
                unitIsZhang: this.chartData.unitIsZhang,
                result: {
                    unit: s,
                    value: e
                }
            },
            {
                unit: s,
                value: e
            })
        },
        xAxisOption: function() {
            var i = this;
            return [{
                type: "category",
                axisLine: {
                    onZero: !1,
                    show: !1
                },
                axisLabel: {
                    color: "#7f7f7f",
                    showMinLabel: !0,
                    showMaxLabel: !0,
                    interval: 0,
                    formatter: function(t, a) {
                        return i.formatXlabelFormat(t, a)
                    },
                    fontSize: i.chartData.isChinext && !0 !== i.chartData.isDelisting ? 9 : i.formatFontsize()
                },
                axisTick: {
                    show: !1
                },
                axisPointer: {
                    show: !this.chartData.isInit
                },
                data: []
            }, {
                type: "category",
                gridIndex: 1,
                splitLine: {
                    show: !0,
                    lineStyle: {
                        color: i.settings.color.lineColor
                    }
                },
                axisLine: {
                    onZero: !1,
                    lineStyle: {
                        color: i.settings.color.lineColor
                    }
                },
                axisTick: {
                    show: !1
                },
                axisLabel: {
                    show: !1
                },
                axisPointer: {
                    show: !this.chartData.isInit
                },
                data: []
            }]
        },
        yAxisOption: function() {
            var t = this.chartData.isInit || this.chartData.isOneData
              , a = this;
            return [{
                type: this.chartData.isInit || this.chartData.isOneData ? "category" : "value",
                scale: !0,
                boundaryGap: !!this.chartData.isInit,
                axisTick: {
                    show: !1
                },
                axisLine: {
                    show: !1
                },
                splitLine: {
                    show: !1
                },
                axisLabel: {
                    color: a.settings.color.fontColor,
                    formatter: function(t) {
                        return a.chartData.isFail ? "0.00" : a.chartData.isInit || a.chartData.isOneData ? t : t.toFixed(a.chartData.decimal)
                    },
                    fontSize: a.formatFontsize()
                },
                min: t ? null : this.chartData.yData.min,
                max: t ? null : this.chartData.yData.max,
                interval: t ? null : this.chartData.yData.interval
            }, {
                type: this.chartData.isInit && !this.chartData.isOneData ? "category" : "value",
                scale: !0,
                boundaryGap: !!this.chartData.isInit,
                gridIndex: 1,
                splitNumber: 3,
                splitLine: {
                    show: !0,
                    lineStyle: {
                        color: this.settings.color.lineColor
                    }
                },
                axisTick: {
                    show: !1
                },
                axisLine: {
                    lineStyle: {
                        color: this.settings.color.lineColor
                    }
                },
                axisLabel: {
                    show: !this.chartData.isInit,
                    color: this.settings.color.fontColor,
                    formatter: function(t) {
                        return a.settings.isEn ? a.calcuUnitEn(t, 0, !0).value + "(" + a.calcuUnitEn(t, 0, !0).unit + ")" : a.calcuUnit(t, 0)
                    },
                    fontSize: a.formatFontsize()
                }
            }]
        },
        gridOption: function() {
            var t = this.chartData.isSec ? this.settings.grid.sec : this.settings.grid.index
              , a = this.chartData.isSec ? this.settings.failGrid.sec : this.settings.failGrid.index;
            return [{
                top: this.chartData.isFail ? a[0][0] : t[0][0],
                right: this.chartData.isFail ? a[0][1] : t[0][1],
                bottom: this.chartData.isFail ? a[0][2] : t[0][2],
                left: this.chartData.isFail ? a[0][3] : t[0][3]
            }, {
                top: this.chartData.isFail ? a[1][0] : t[1][0],
                right: this.chartData.isFail ? a[1][1] : t[1][1],
                bottom: this.chartData.isFail ? a[1][2] : t[1][2],
                left: this.chartData.isFail ? a[1][3] : t[1][3]
            }]
        },
        markLineDataOption: function() {
            return [{
                name: "4/4线",
                yAxis: this.chartData.yData.max
            }, {
                name: "3/4线",
                yAxis: this.chartData.yData.threeQuarter
            }, {
                name: "昨收线",
                yAxis: this.chartData.close.toFixed(this.chartData.decimal),
                lineStyle: {
                    normal: {
                        color: this.settings.color.closeLineColor
                    }
                }
            }, {
                name: "1/4线",
                yAxis: this.chartData.yData.quarter
            }, {
                name: "0/4线",
                yAxis: this.chartData.yData.min
            }]
        },
        secLineOption: function() {
            var i = this;
            return {
                animation: !1,
                tooltip: {
                    trigger: "axis",
                    formatter: function(t) {
                        var a = "";
                        return t.map(function(t) {
                            0 === t.seriesIndex && (i.parseTooltipsData(t),
                            a = i.buildTooltip(t))
                        }),
                        a.html()
                    },
                    axisPointer: {
                        lineStyle: {
                            color: i.settings.color.pointerColor
                        }
                    },
                    backgroundColor: i.settings.color.toolBgColor,
                    padding: [10, 20, 10, 14],
                    textStyle: {
                        color: i.settings.color.fontColor,
                        fontSize: 12
                    },
                    position: function(t, a, i, s, e) {
                        var n = {
                            top: "4%"
                        };
                        return t[0] < e.viewSize[0] / 2 ? n.right = 10 : n.left = 30,
                        n
                    },
                    extraCssText: "box-shadow: 0 0 6px rgba(0, 0, 0, .075)"
                },
                axisPointer: {
                    link: {
                        xAxisIndex: "all"
                    },
                    label: {
                        backgroundColor: "#777"
                    }
                },
                visualMap: {
                    show: !1,
                    seriesIndex: 2,
                    dimension: 2,
                    pieces: [{
                        value: "plus",
                        color: i.settings.color.volUpColor
                    }, {
                        value: "minus",
                        color: i.settings.color.volDownColr
                    }]
                },
                grid: this.gridOption(),
                xAxis: this.xAxisOption(),
                yAxis: this.yAxisOption(),
                series: [{
                    name: "最新",
                    type: "line",
                    smooth: !0,
                    symbol: "circle",
                    symbolSize: 6,
                    showSymbol: !1,
                    connectNulls: !0,
                    itemStyle: {
                        normal: {
                            shadowColor: i.settings.color.pointerColor,
                            shadowBlur: 16
                        }
                    },
                    lineStyle: {
                        normal: {
                            width: 1.4,
                            color: i.settings.color.newestColor
                        }
                    },
                    areaStyle: {
                        normal: {
                            color: new echarts.graphic.LinearGradient(0,0,0,1,[{
                                offset: 0,
                                color: "#adcefa"
                            }, {
                                offset: 1,
                                color: "#e5f3fe"
                            }])
                        }
                    },
                    markLine: {
                        id: "markLine",
                        silent: !0,
                        symbol: ["none", "none"],
                        label: {
                            normal: {
                                color: this.settings.color.fontColor,
                                formatter: function(t) {
                                    return i.chartData.isFail ? "0.00%" : 0 == i.chartData.close ? (100 * +t.value).toFixed(i.chartData.decimal) + "%" : (+window.util.fSubtract(t.value, i.chartData.close) / i.chartData.close * 100).toFixed(i.chartData.decimal) + "%"
                                },
                                fontSize: i.formatFontsize()
                            }
                        },
                        lineStyle: {
                            normal: {
                                color: this.settings.color.lineColor
                            }
                        },
                        data: [],
                        animation: !1
                    },
                    data: []
                }, {
                    name: "均价",
                    type: "line",
                    smooth: !0,
                    symbolSize: 0,
                    showSymbol: !1,
                    symbol: "circle",
                    connectNulls: !0,
                    lineStyle: {
                        normal: {
                            width: 1.4,
                            color: i.settings.color.averageColor
                        }
                    },
                    data: []
                }, {
                    name: "Volume",
                    type: "bar",
                    xAxisIndex: 1,
                    yAxisIndex: 1,
                    data: []
                }, {
                    name: "iopv",
                    type: "line",
                    smooth: !0,
                    symbolSize: 0,
                    showSymbol: !1,
                    symbol: "circle",
                    connectNulls: !0,
                    lineStyle: {
                        normal: {
                            width: 1.1,
                            color: i.settings.color.iopvColor
                        }
                    },
                    data: []
                }]
            }
        },
        secLine: function(t) {
            var a = echarts.init(this.element[0])
              , i = this.secLineOption();
            a.setOption(i),
            this.settings.chart = a,
            this.resize(),
            this.chartData.isSec ? this.setSecOption() : this.setIndexOption()
        },
        updateOption: function(t) {
            this.parseData(t.data),
            this.calcuBaseline();
            var a = this.xAxisOption()
              , i = this.yAxisOption()
              , s = this.resetData()
              , e = this.gridOption();
            this.settings.chart.setOption({
                grid: e,
                xAxis: a,
                yAxis: i,
                series: s
            }),
            this.chartData.isSec ? this.setSecOption() : this.setIndexOption()
        },
        resetData: function() {
            return [{
                data: []
            }, {
                data: []
            }, {
                data: []
            }, {
                data: []
            }]
        },
        setSecOption: function() {
            var t = this.chartData.categoryData;
            (this.chartData.isPledgeStyleBond || this.chartData.isChinext && !0 !== this.chartData.isDelisting) && (this.chartData.isPledgeStyleBond && (t = t.concat(["15:01", "15:02", "15:03", "15:04", "15:05"])),
            t = t.concat(this.chartData.extCategoryData));
            var a = {
                xAxis: [{
                    axisPointer: {
                        show: !this.chartData.isInit
                    },
                    data: t
                }, {
                    axisPointer: {
                        show: !this.chartData.isInit
                    },
                    data: t
                }],
                series: [{
                    name: "最新",
                    markLine: {
                        id: "markLine",
                        label: {
                            normal: {
                                show: !0
                            }
                        },
                        data: this.markLineDataOption()
                    },
                    data: this.chartData.newest
                }, {
                    name: "均价",
                    data: this.chartData.average
                }, {
                    name: "Volume",
                    data: this.chartData.volumes
                }, {
                    name: "iopv",
                    data: this.chartData.iopv
                }]
            };
            this.chartData.isInit && (a.yAxis = [{
                data: this.chartData.initY1Data
            }, {
                data: this.chartData.initY2Data
            }]),
            this.chartData.isOneData && (a.yAxis = [{
                data: this.chartData.initY1Data
            }]),
            this.settings.chart.setOption(a)
        },
        setIndexOption: function() {
            var t = this.chartData.categoryData;
            (this.chartData.isPledgeStyleBond || this.chartData.isChinext && !0 !== this.chartData.isDelisting) && (this.chartData.isPledgeStyleBond && (t = t.concat(["15:01", "15:02", "15:03", "15:04", "15:05"])),
            t = t.concat(this.chartData.extCategoryData));
            var a = {
                xAxis: {
                    axisPointer: {
                        show: !this.chartData.isInit
                    },
                    data: t
                },
                series: [{
                    name: "最新",
                    markLine: {
                        id: "markLine",
                        label: {
                            normal: {
                                show: !1
                            }
                        },
                        data: this.markLineDataOption()
                    },
                    data: this.chartData.newest
                }]
            };
            (this.chartData.isInit || this.chartData.isOneData) && (a.yAxis = [{
                data: this.chartData.initY1Data
            }]),
            this.settings.chart.setOption(a)
        },
        resize: function() {
            var t = this;
            $(window).on("resize", function() {
                t.w365 = !1,
                t.w295 = !1,
                t.element.width() < 365 && (t.w365 = !0),
                t.element.width() < 295 && (t.w295 = !0),
                t.settings.chart.resize()
            })
        },
        formatXlabelFormat: function(t, a) {
            if ("09:30" === t)
                return t;
            if ("10:30" === t)
                if (this.chartData.isPledgeStyleBond || this.chartData.isChinext && !0 !== this.chartData.isDelisting) {
                    if (!this.w365)
                        return t
                } else if (!this.w295)
                    return t;
            return "11:30" === t ? "11:30/13:00" : "14:00" === t ? t : "15:00" === t ? this.chartData.isChinext && !0 !== this.chartData.isDelisting ? "15:00/15:05" : t : "15:30" === t ? t : null
        },
        formatXLabelInterval: function(t, a) {
            return "09:30" === a ? a : "10:00" === a ? a : "10:30" === a ? a : "11:00" === a ? a : "11:30" === a ? a : "13:30" === a ? a : "14:00" === a ? a : "14:30" === a ? a : "15:00" === a ? a : "15:30" === a && a
        },
        formatFontsize: function() {
            return this.w295 ? 8 : this.w365 ? 9 : 12
        },
        getInstance: function() {
            return this.settings.chart
        }
    })
});
Jx().package("s.ui.controls", function(t) {
    "use strict";
    var i = 0;
    this.kLineChart = new t.Class({
        extend: s.ui.BaseControl
    },{
        defaults: {
            color: {
                MA5: "#319e26",
                MA10: "#2c52e1",
                MA20: "#db3338",
                upColor: "#db3338",
                downColor: "#319e26",
                lineColor: "#e1e1e1",
                closeLineColor: "#a0a0a0",
                fontColor: "#7f7f7f",
                pointerColor: "#db3338",
                toolBgColor: "#fff",
                volUpColor: "#f29b76",
                volDownColr: "#5573aa"
            },
            grid: [["4%", 68, "48%", 38], ["65%", 68, "16%", 38]],
            noDataGrid: [["4%", 20, "48%", 20], ["65%", 20, "16%", 20]]
        },
        attributeMap: {},
        init: function(t, a) {
            this.element = $(t),
            this.container = this.element,
            this.element.data("initialized") || (this.element.data("initialized", !0),
            i += 1,
            this.element.data("plugin-id", i),
            this.initSettings(a),
            this.settings.isEn = window.util.isEnglish(),
            this.parseData(this.settings.data),
            this.render(this.chartData))
        },
        parseData: function(t) {
            var a = t.type;
            if (t = t.data,
            $.isEmptyObject(t))
                console.warn("实例未获取到无数据!");
            else if (t.picupdata && !$.isEmptyObject(t.picupdata)) {
                var s = "";
                200 < t.picupdata.length && (s = t.picupdata.splice(0, 1)[0][2],
                t.picdowndata.splice(0, 1));
                for (var i, n = [], e = t.picupdata.length, o = 0; o < e; o++)
                    n.push(t.picupdata[o].splice(0, 1)[0]);
                if (e < 50) {
                    for (var l = 0; l < 50 - e; l++)
                        n.push(null);
                    i = 0
                } else
                    i = 100 - Math.floor(50 / e * 100);
                var r = t.picupdata
                  , h = t.picdowndata
                  , c = this.calcuDecimal(r);
                this.chartData = {
                    dataStart: i,
                    categoryData: n,
                    values: r,
                    volumes: h,
                    decimal: c,
                    fistLastClose: s,
                    isBond: a && "bond" === a,
                    isOption: a && "option" === a
                },
                function() {
                    this.unitIsZhang = this.isBond || this.isOption
                }
                .call(this.chartData)
            } else
                this.chartData = {
                    isInit: !0,
                    dataStart: 0,
                    categoryData: ["1", "2", "3"],
                    values: [],
                    volumes: [],
                    initY1Data: ["1", "2", "3", "4", "5", "6"],
                    initY2Data: ["1", "2", "3"]
                }
        },
        calcuDecimal: function(t) {
            var a = t.length;
            if (!(a < 1)) {
                for (var s = [], i = [], n = 0; n < 5; n++)
                    s.push(t[Math.round(Math.random() * (a - 1))][0]);
                return s.forEach(function(t) {
                    /\./g.test(t += "") && i.push(t.split(".")[1].length)
                }),
                i.length < 1 ? 0 : Math.max.apply(null, i)
            }
        },
        render: function(t) {
            this.kLine(t),
            this.buildMATip(),
            this.initElements(),
            this.bindEvents()
        },
        initElements: function() {
            this.elements = {
                MAWrap: $(".MA-wrap", this.container),
                MA5: $(".MA-wrap .MA5 .value", this.container),
                MA10: $(".MA-wrap .MA10 .value", this.container),
                MA20: $(".MA-wrap .MA20 .value", this.container)
            }
        },
        bindEvents: function() {
            this.element.on({
                mouseenter: $.proxy(this.showMAWrap, this),
                mouseleave: $.proxy(this.hideMAWrap, this)
            })
        },
        showMAWrap: function() {
            this.elements.MAWrap.css("visibility", "visible")
        },
        hideMAWrap: function() {
            this.elements.MAWrap.css("visibility", "hidden")
        },
        changeMA: function(t) {
            var a, s, i, n = this;
            t.map(function(t) {
                "MA5" === t.seriesName && (a = "string" == typeof t.value ? t.value : t.value.toFixed(n.chartData.decimal)),
                "MA10" === t.seriesName && (s = "string" == typeof t.value ? t.value : t.value.toFixed(n.chartData.decimal)),
                "MA20" === t.seriesName && (i = "string" == typeof t.value ? t.value : t.value.toFixed(n.chartData.decimal))
            }),
            this.elements.MA5.text(a),
            this.elements.MA10.text(s),
            this.elements.MA20.text(i)
        },
        buildMATip: function() {
            this.element.append($('<ul class=MA-wrap>   <li class="MA5">MA5：<span class="value"></span></li>   <li class="MA10">MA10：<span class="value"></span></li>   <li class="MA20">MA20：<span class="value"></span></li></ul>'))
        },
        calculateMA: function(t, a, s) {
            for (var i = [], n = 0, e = a.values.length; n < e; n++)
                if (n < t - 1)
                    i.push("-");
                else {
                    for (var o = 0, l = 0; l < t; l++)
                        s && (o += +a.volumes[n - l][1]),
                        o += +a.values[n - l][1];
                    i.push(+(o / t).toFixed(this.chartData.decimal))
                }
            return i
        },
        buildTooltip: function(t) {
            return this.settings.isEn ? this.tooltipEn(t) : this.tooltip(t)
        },
        tooltip: function(t) {
            var a = $("<div>")
              , s = '<div class="sectooltip-container">';
            return s += '<span class="time">' + t.axisValue + "&nbsp;&nbsp;" + ["周日", "周一", "周二", "周三", "周四", "周五", "周六"][new Date(t.axisValue.replace(/-/g, "/")).getDay()] + '</span><br/><span class="name"><i>：</i>开盘</span><span class="value ' + (!0 === t.openIsDown ? "open-down" : null === t.openIsDown ? "" : "open-up") + '">' + this.formatToolTipsData(t.data[1]) + '</span><br/><span class="name"><i>：</i>最高</span><span class="value ' + (!0 === t.highIsDown ? "high-down" : null === t.highIsDown ? "" : "high-up") + '">' + this.formatToolTipsData(t.data[4]) + '</span><br/><span class="name"><i>：</i>最低</span><span class="value ' + (!0 === t.lowIsDown ? "low-down" : null === t.lowIsDown ? "" : "low-up") + '">' + this.formatToolTipsData(t.data[3]) + '</span><br/><span class="name"><i>：</i>收盘</span><span class="value ' + (!0 === t.closeIsDown ? "close-down" : null === t.closeIsDown ? "" : "close-up") + '">' + this.formatToolTipsData(t.data[2]) + '</span><br/><span class="name"><i>：</i>涨跌</span><span class="value ' + (!0 === t.deltaIsDown ? "delta-down" : null === t.deltaIsDown ? "" : "delta-up") + '">' + this.formatToolTipsData(t.data[5]) + '</span><br/><span class="name"><i>：</i>涨幅</span><span class="value ' + (!0 === t.deltaIsDown ? "delta-down" : null === t.deltaIsDown ? "" : "delta-up") + '">' + this.formatToolTipsData(t.data[6]) + '%</span><br/><span class="name"><i>：</i>成交量</span><span class="value">' + this.calcuUnit(t.data[7], 2) + (this.chartData.unitIsZhang ? "张" : "手") + '</span><br/><span class="name"><i>：</i>成交额</span><span class="value">' + this.calcuUnit(t.data[8], 2) + "元</span><br/></div>",
            a.html(s)
        },
        tooltipEn: function(t) {
            var a = $("<div>")
              , s = '<div class="sectooltip-container english">';
            return s += '<span class="time">' + t.axisValue + "&nbsp;&nbsp;" + ["Sun.", "Mon.", "Tue.", "Wed.", "Thur.", "Fri.", "Sat."][new Date(t.axisValue.replace(/-/g, "/")).getDay()] + '</span><br/><span class="name"><i>：</i>Open</span><span class="value ' + (!0 === t.openIsDown ? "open-down" : null === t.openIsDown ? "" : "open-up") + '">' + this.formatToolTipsData(t.data[1]) + '</span><br/><span class="name"><i>：</i>High</span><span class="value ' + (!0 === t.highIsDown ? "high-down" : null === t.highIsDown ? "" : "high-up") + '">' + this.formatToolTipsData(t.data[4]) + '</span><br/><span class="name"><i>：</i>Low</span><span class="value ' + (!0 === t.lowIsDown ? "low-down" : null === t.lowIsDown ? "" : "low-up") + '">' + this.formatToolTipsData(t.data[3]) + '</span><br/><span class="name"><i>：</i>Close</span><span class="value ' + (!0 === t.closeIsDown ? "close-down" : null === t.closeIsDown ? "" : "close-up") + '">' + this.formatToolTipsData(t.data[2]) + '</span><br/><span class="name"><i>：</i>Change</span><span class="value ' + (!0 === t.deltaIsDown ? "delta-down" : null === t.deltaIsDown ? "" : "delta-up") + '">' + this.formatToolTipsData(t.data[5]) + '</span><br/><span class="name"><i>：</i>Change(%)</span><span class="value ' + (!0 === t.deltaIsDown ? "delta-down" : null === t.deltaIsDown ? "" : "delta-up") + '">' + this.formatToolTipsData(t.data[6]) + '</span><br/><span class="name"><i>：</i>Volume(' + this.calcuUnitEn(t.data[7], 2, !0).unit + ')</span><span class="value">' + this.calcuUnitEn(t.data[7], 2, !0).value + '</span><br/><span class="name"><i>：</i>Amount(' + this.calcuUnitEn(t.data[8], 2).unit + ')</span><span class="value">' + this.calcuUnitEn(t.data[8], 2).value + "</span><br/></div>",
            a.html(s)
        },
        formatToolTipsData: function(t) {
            return null == t ? "--" : t
        },
        parseTooltipsData: function(t) {
            var a = t.dataIndex - 1
              , s = "";
            s = a < 0 ? this.chartData.fistLastClose ? +this.chartData.fistLastClose : this.chartData.values[1 + a][1] : +this.chartData.values[a][1],
            t.openIsDown = +t.data[1] < s,
            t.closeIsDown = +t.data[2] < s,
            t.highIsDown = +t.data[4] < s,
            t.lowIsDown = +t.data[3] < s,
            t.deltaIsDown = /^\-/.test(t.data[5])
        },
        calcuUnit: function(t, a) {
            var s = "";
            return null == t ? "--" : 1 <= t / 1e8 ? (s = t / 1e8).toString().length < 4 ? s + "亿" : s.toFixed(a) + "亿" : 1 <= t / 1e4 ? (s = t / 1e4).toString().length < 4 ? s + "万" : s.toFixed(a) + "万" : t
        },
        calcuUnitEn: function(t, a, s) {
            var i = ""
              , n = ""
              , e = "";
            return this.settings.unitCache && this.settings.unitCache.num === t && this.settings.unitCache.unitIsZhang === this.chartData.unitIsZhang ? this.settings.unitCache.result : (n = null == t ? (i = s ? this.chartData.unitIsZhang ? "10" : "100" : "Yuan",
            "--") : 1 <= t / 1e8 ? (e = t / 1e8,
            i = s ? this.chartData.unitIsZhang ? "Bil." : "10Bil." : "100Mil.",
            e.toString().length < 4 ? e : e.toFixed(a)) : 1 <= t / 1e4 ? (e = t / 1e4,
            i = s ? this.chartData.unitIsZhang ? "10,000" : "Mil." : "10,000",
            e.toString().length < 4 ? e : e.toFixed(a)) : (i = s ? "100" : "Yuan",
            t),
            this.settings.unitCache = {
                num: t,
                unitIsZhang: this.chartData.unitIsZhang,
                result: {
                    unit: i,
                    value: n
                }
            },
            {
                unit: i,
                value: n
            })
        },
        dataZoomOption: function() {
            return [{
                type: "inside",
                xAxisIndex: [0, 1],
                start: this.chartData.dataStart,
                throttle: 0,
                zoomLock: 0 === this.chartData.dataStart,
                end: 100
            }, {
                show: 0 !== this.chartData.dataStart,
                xAxisIndex: [0, 1],
                type: "slider",
                bottom: "3%",
                throttle: 0,
                start: this.chartData.dataStart,
                end: 100,
                height: "8%",
                zoomLock: 0 === this.chartData.dataStart,
                showDetail: !1,
                handleIcon: "M10.7,11.9v-1.3H9.3v1.3c-4.9,0.3-8.8,4.4-8.8,9.4c0,5,3.9,9.1,8.8,9.4v1.3h1.3v-1.3c4.9-0.3,8.8-4.4,8.8-9.4C19.5,16.3,15.6,12.2,10.7,11.9z M13.3,24.4H6.7V23h6.6V24.4z M13.3,19.6H6.7v-1.4h6.6V19.6z",
                handleSize: "80%",
                handleStyle: {
                    color: "#fff",
                    shadowBlur: 3,
                    shadowColor: "rgba(0, 0, 0, 0.6)",
                    shadowOffsetX: 2,
                    shadowOffsetY: 2
                }
            }]
        },
        gridOption: function() {
            return [{
                show: !0,
                borderColor: this.settings.color.lineColor,
                borderWidth: .5,
                zlevel: 10,
                top: this.chartData.isInit ? this.settings.noDataGrid[0][0] : this.settings.grid[0][0],
                right: this.chartData.isInit ? this.settings.noDataGrid[0][1] : this.settings.grid[0][1],
                bottom: this.chartData.isInit ? this.settings.noDataGrid[0][2] : this.settings.grid[0][2],
                left: this.chartData.isInit ? this.settings.noDataGrid[0][3] : this.settings.grid[0][3]
            }, {
                show: !0,
                borderColor: this.settings.color.lineColor,
                borderWidth: .5,
                zlevel: 10,
                top: this.chartData.isInit ? this.settings.noDataGrid[1][0] : this.settings.grid[1][0],
                right: this.chartData.isInit ? this.settings.noDataGrid[1][1] : this.settings.grid[1][1],
                bottom: this.chartData.isInit ? this.settings.noDataGrid[1][2] : this.settings.grid[1][2],
                left: this.chartData.isInit ? this.settings.noDataGrid[1][3] : this.settings.grid[1][3]
            }]
        },
        yAxisOption: function() {
            var a = this;
            return [{
                type: this.chartData.isInit ? "category" : "value",
                boundaryGap: !this.chartData.isInit,
                scale: !0,
                position: "right",
                axisLabel: {
                    show: !this.chartData.isInit,
                    color: this.settings.color.fontColor,
                    formatter: function(t) {
                        return a.chartData.isInit ? t : t.toFixed(a.chartData.decimal)
                    }
                },
                axisTick: {
                    show: !1
                },
                splitLine: {
                    show: !0,
                    lineStyle: {
                        color: this.settings.color.lineColor,
                        type: "dashed"
                    }
                },
                axisLine: {
                    show: !1
                },
                axisPointer: {
                    show: !this.chartData.isInit,
                    label: {
                        show: !1
                    },
                    snap: !0,
                    lineStyle: {
                        type: "solid",
                        color: this.settings.color.pointerColor
                    }
                }
            }, {
                type: this.chartData.isInit ? "category" : "value",
                boundaryGap: !this.chartData.isInit,
                gridIndex: 1,
                splitNumber: 2,
                position: "right",
                axisLabel: {
                    color: this.settings.color.fontColor,
                    formatter: function(t) {
                        if (!a.chartData.isInit)
                            return a.settings.isEn ? a.calcuUnitEn(t, 0, !0).value + "(" + a.calcuUnitEn(t, 0, !0).unit + ")" : a.calcuUnit(t, 0)
                    }
                },
                axisTick: {
                    show: !1
                },
                splitLine: {
                    show: !0,
                    lineStyle: {
                        color: this.settings.color.lineColor,
                        type: "dashed"
                    }
                },
                axisLine: {
                    lineStyle: {
                        color: this.settings.color.lineColor
                    }
                },
                axisPointer: {
                    show: !this.chartData.isInit,
                    label: {
                        show: !1
                    },
                    snap: !0,
                    lineStyle: {
                        type: "solid",
                        color: this.settings.color.pointerColor
                    }
                }
            }]
        },
        kLineOption: function() {
            var s = this;
            return {
                animation: !1,
                tooltip: {
                    trigger: "axis",
                    backgroundColor: s.settings.color.toolBgColor,
                    padding: [10, 20, 10, 14],
                    formatter: function(t) {
                        var a = "";
                        return s.changeMA(t),
                        t.every(function(t) {
                            return 0 !== t.seriesIndex || (s.parseTooltipsData(t),
                            a = s.buildTooltip(t),
                            !1)
                        }),
                        a.html()
                    },
                    axisPointer: {
                        type: "cross",
                        label: {
                            show: !1
                        },
                        lineStyle: {
                            color: s.settings.color.pointerColor
                        }
                    },
                    textStyle: {
                        color: s.settings.color.fontColor,
                        fontSize: 12
                    },
                    position: function(t, a, s, i, n) {
                        var e = {
                            top: "5%"
                        };
                        return t[0] < n.viewSize[0] / 2 ? e.right = 65 : e.left = 40,
                        e
                    },
                    extraCssText: "box-shadow: 0 0 6px rgba(0, 0, 0, .075)"
                },
                axisPointer: {
                    label: {
                        show: !1
                    },
                    link: {
                        xAxisIndex: [0, 1]
                    }
                },
                visualMap: [{
                    show: !1,
                    seriesIndex: 4,
                    dimension: 2,
                    pieces: [{
                        value: "plus",
                        color: s.settings.color.upColor
                    }, {
                        value: "minus",
                        color: s.settings.color.downColor
                    }]
                }],
                grid: this.gridOption(),
                dataZoom: this.dataZoomOption(),
                xAxis: [{
                    type: "category",
                    scale: !0,
                    boundaryGap: !this.chartData.isInit,
                    axisLine: {
                        onZero: !1,
                        show: !1
                    },
                    axisTick: {
                        show: !1
                    },
                    splitLine: {
                        show: !!this.chartData.isInit,
                        lineStyle: {
                            color: this.settings.color.lineColor,
                            type: "dashed"
                        }
                    },
                    axisLabel: {
                        color: s.settings.color.fontColor,
                        formatter: function(t) {
                            if (!s.chartData.isInit)
                                return "null" !== t ? t : void 0
                        }
                    },
                    splitNumber: 20,
                    axisPointer: {
                        show: !this.chartData.isInit,
                        label: {
                            show: !1
                        }
                    },
                    data: s.chartData.categoryData
                }, {
                    type: "category",
                    gridIndex: 1,
                    boundaryGap: !this.chartData.isInit,
                    scale: !0,
                    axisLine: {
                        onZero: !1,
                        lineStyle: {
                            color: s.settings.color.lineColor
                        }
                    },
                    axisTick: {
                        show: !1
                    },
                    splitLine: {
                        show: !!this.chartData.isInit,
                        lineStyle: {
                            color: this.settings.color.lineColor,
                            type: "dashed"
                        }
                    },
                    axisLabel: {
                        show: !1
                    },
                    splitNumber: 20,
                    data: s.chartData.categoryData,
                    axisPointer: {
                        show: !this.chartData.isInit,
                        label: {
                            show: !1
                        }
                    }
                }],
                yAxis: this.yAxisOption(),
                series: [{
                    name: "Dow-Jones index",
                    type: "candlestick",
                    itemStyle: {
                        normal: {
                            color: s.settings.color.upColor,
                            color0: s.settings.color.downColor,
                            borderColor: null,
                            borderColor0: null
                        }
                    },
                    barWidth: "60%",
                    data: []
                }, {
                    name: "MA5",
                    type: "line",
                    smooth: !0,
                    symbol: "circle",
                    symbolSize: 0,
                    showSymbol: !1,
                    connectNulls: !0,
                    lineStyle: {
                        normal: {
                            width: 1.2,
                            color: s.settings.color.MA5
                        }
                    },
                    z: 300,
                    data: []
                }, {
                    name: "MA10",
                    type: "line",
                    smooth: !0,
                    symbol: "circle",
                    symbolSize: 0,
                    showSymbol: !1,
                    connectNulls: !0,
                    lineStyle: {
                        normal: {
                            width: 1.2,
                            color: s.settings.color.MA10
                        }
                    },
                    z: 300,
                    data: []
                }, {
                    name: "MA20",
                    type: "line",
                    smooth: !0,
                    symbol: "circle",
                    symbolSize: 0,
                    showSymbol: !1,
                    connectNulls: !0,
                    lineStyle: {
                        normal: {
                            width: 1.2,
                            color: s.settings.color.MA20
                        }
                    },
                    z: 300,
                    data: []
                }, {
                    name: "Volume",
                    type: "bar",
                    xAxisIndex: 1,
                    yAxisIndex: 1,
                    barWidth: "60%",
                    data: []
                }, {
                    name: "VMA5",
                    type: "line",
                    xAxisIndex: 1,
                    yAxisIndex: 1,
                    smooth: !0,
                    symbol: "circle",
                    symbolSize: 0,
                    showSymbol: !1,
                    connectNulls: !0,
                    lineStyle: {
                        normal: {
                            width: 1.2,
                            color: s.settings.color.MA5
                        }
                    },
                    data: []
                }, {
                    name: "VMA10",
                    type: "line",
                    xAxisIndex: 1,
                    yAxisIndex: 1,
                    smooth: !0,
                    symbol: "circle",
                    symbolSize: 0,
                    showSymbol: !1,
                    connectNulls: !0,
                    lineStyle: {
                        normal: {
                            width: 1.2,
                            color: s.settings.color.MA10
                        }
                    },
                    data: []
                }, {
                    name: "VMA20",
                    type: "line",
                    xAxisIndex: 1,
                    yAxisIndex: 1,
                    smooth: !0,
                    symbol: "circle",
                    symbolSize: 0,
                    showSymbol: !1,
                    connectNulls: !0,
                    lineStyle: {
                        normal: {
                            width: 1.2,
                            color: s.settings.color.MA20
                        }
                    },
                    data: []
                }]
            }
        },
        kLine: function(t) {
            var a = echarts.init(this.element[0])
              , s = this.kLineOption();
            a.setOption(s),
            this.settings.chart = a,
            this.setKLineData()
        },
        updateOption: function(t) {
            this.parseData(t.data);
            var a = this.yAxisOption()
              , s = this.gridOption()
              , i = this.dataZoomOption()
              , n = this.resetData();
            this.settings.chart.setOption({
                grid: s,
                dataZoom: i,
                yAxis: a,
                series: n
            }),
            this.setKLineData()
        },
        setKLineData: function() {
            var t = {
                xAxis: [{
                    axisPointer: {
                        show: !this.chartData.isInit
                    },
                    boundaryGap: !this.chartData.isInit,
                    splitLine: {
                        show: !!this.chartData.isInit
                    },
                    data: this.chartData.categoryData
                }, {
                    axisPointer: {
                        show: !this.chartData.isInit
                    },
                    boundaryGap: !this.chartData.isInit,
                    splitLine: {
                        show: !!this.chartData.isInit
                    },
                    data: this.chartData.categoryData
                }],
                series: [{
                    name: "Dow-Jones index",
                    data: this.chartData.values
                }, {
                    name: "MA5",
                    data: this.calculateMA(5, this.chartData)
                }, {
                    name: "MA10",
                    data: this.calculateMA(10, this.chartData)
                }, {
                    name: "MA20",
                    data: this.calculateMA(20, this.chartData)
                }, {
                    name: "Volume",
                    data: this.chartData.volumes
                }, {
                    name: "VMA5",
                    data: this.calculateMA(5, this.chartData, !0)
                }, {
                    name: "VMA10",
                    data: this.calculateMA(10, this.chartData, !0)
                }, {
                    name: "VMA20",
                    data: this.calculateMA(20, this.chartData, !0)
                }]
            };
            this.chartData.isInit && (t.yAxis = [{
                data: this.chartData.initY1Data
            }, {
                data: this.chartData.initY2Data
            }]),
            this.settings.chart.resize(),
            this.settings.chart.setOption(t),
            this.resize()
        },
        resetData: function() {
            return [{
                data: []
            }, {
                data: []
            }, {
                data: []
            }, {
                data: []
            }, {
                data: []
            }, {
                data: []
            }, {
                data: []
            }, {
                data: []
            }]
        },
        resize: function() {
            var t = this;
            $(window).on("resize", function() {
                t.settings.chart.resize()
            })
        },
        getEchartsInstance: function() {
            return this.settings.chart
        }
    })
});
